#include <iostream>
#include <string.h>
using namespace std;

const int size=128;
void main()
{	
	char mas[size];
	char m;
	gets(mas);
	cin>>m;
	for(int i=strlen(mas);i>=0;i--)
	{
		
		if(mas[i]==m)
		{
			cout<<i<<" element is coincides\n";
			break;
		}
		cout<<"";
	}
	
}